#pragma once
#include "IGameState.h"
#include "../SGD Wrappers/SGD_Handle.h"
#include "../SGD Wrappers/SGD_Declarations.h"
#include "../SGD Wrappers/SGD_Geometry.h"

class Menu;
class EntityManager;
class Player;
class Lightorb;
class Planets;
class Enemy;
class Entity;
class ParticleManager;
class BitmapFont;

class HowToState : public IGameState
{
public:
	//Singleton accessor
	static HowToState* GetInstance();

	//IGameStateInterface
	virtual void Enter() override; //load resources
	virtual void Exit() override; //unload resources
	virtual bool Input() override; //handle user input
	virtual void Update(float elapsedTime) override; //update entities
	virtual void Render() override; //render entities/menu items

	//Factory methods
	Player* CreatePlayer();
	Enemy* CreateEnemy();
	Entity* CreateProjectile(Enemy* owner, void*data = nullptr) const;
	Entity* FireGrapple(Entity* owner);
	Planets* CreatePlanet();
	Lightorb* CreateLightorb();

	Player* GetPlayer() const { return player; }

	bool GetToGame() const { return toGame; }
	void SetToGame(bool g) { toGame = g; }

private:
	HowToState() = default;
	virtual ~HowToState() = default;
	HowToState(const HowToState&) = delete;
	HowToState& operator=(const HowToState&) = delete;

	Menu* menu = nullptr;
	EntityManager* entities = nullptr;
	Player* player = nullptr;
	Lightorb* lOrb = nullptr;
	Enemy* enemy = nullptr;

	//Message manager
	SGD::MessageManager* messages = nullptr;

	//SGD wrappers
	SGD::AudioManager* audio = nullptr;
	SGD::GraphicsManager* graphics = nullptr;
	SGD::InputManager* input = nullptr;

	// Message Callback Function:
	static void MessageProc(const SGD::Message* pMsg);

	//Particles
	ParticleManager*particles = nullptr;

	//Pause the game
	bool paused = false;

	//Font
	BitmapFont* font = nullptr;

	SGD::HTexture bg = SGD::INVALID_HANDLE;
	SGD::HTexture controls = SGD::INVALID_HANDLE;

	//bools focr tutorial checkpoints
	bool rotateClock = false;
	bool rotateCounter = false;
	bool jumped = false;
	bool grappled = false;
	bool lightCollected = false;
	bool enemyKilled = false;
	bool shaflakKilled = false;

	bool mkbInput = true;
	bool controllerInput = false;

	int planetCounter = 1;
	SGD::Point tempPos;

	//to gameplaystate or not?
	bool toGame = false;
	float end = 5.0f;
};

